package com.cin.cma.server.pos.service.impl;

import com.cin.cma.common.model.finixx.base.BaseRequest;
import com.cin.cma.common.model.finixx.request.AllSystemSettingRequest;
import com.cin.cma.common.model.finixx.request.BKBookingOrderRequest;
import com.cin.cma.common.model.finixx.request.IncreaseBookingSettingRequest;
import com.cin.cma.common.model.finixx.response.*;
import com.cin.cma.common.constant.FunctionCode;
import com.cin.cma.server.pos.service.IBasicService;
import com.cin.cma.server.pos.service.IProxyRequestService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 *
 * @Date：2024-07-18 14:40
 */
@Slf4j
@Service
public class BasicServiceImpl implements IBasicService {
    @Autowired
    private IProxyRequestService proxyRequestService;

    /**
     * 获取接口令牌
     *
     * @param model
     * @return
     */
    @Override
    public PassNumResponse getPassNum(BaseRequest model) throws Exception {
        model.setCode(FunctionCode.BASIC_GET_PASS_NUM);
        return this.proxyRequestService.context(model, PassNumResponse.class);
    }

    /**
     * 获取本地影院信息
     *
     * @param model
     * @return
     */
    @Override
    public LocalCinemaResponse getLocalCinema(BaseRequest model) throws Exception {
        model.setCode(FunctionCode.BASIC_GET_LOCAL_CINEMA);
        return this.proxyRequestService.context(model, LocalCinemaResponse.class);
    }

    /**
     * 预定订单
     *
     * @param model
     * @param transation
     * @return
     */
    @Override
    public BookingOrderResponse bookingOrder(BKBookingOrderRequest model) throws Exception {
        model.setCode(FunctionCode.BASIC_BOOKING_ORDER);
        return this.proxyRequestService.context(model, BookingOrderResponse.class);
    }

    /**
     * 获取系统时间
     *
     * @param model
     * @return
     */
    @Override
    public SystemTimeResponse globalSystemTime(BaseRequest model) throws Exception {
        model.setCode(FunctionCode.BASIC_SYSTEM_TIME);
        return this.proxyRequestService.context(model, SystemTimeResponse.class);
    }

    /**
     * 获取渠道信息
     *
     * @param model
     * @return
     */
    @Override
    public IncreaseBookingSettingResponse getIncreaseBookingSetting(IncreaseBookingSettingRequest model) throws Exception {
        model.setCode(FunctionCode.BASIC_GET_IBT);
        return this.proxyRequestService.context(model, IncreaseBookingSettingResponse.class);
    }

    /**
     * 获取系统基本信息
     *
     * @param model
     * @return
     */
    @Override
    public AllSystemSettingResponse allSystemSetting(AllSystemSettingRequest model) throws Exception {
        model.setCode(FunctionCode.BASIC_GET_ALLSYSTEMSETTING);
        return this.proxyRequestService.context(model, AllSystemSettingResponse.class);
    }
}
